package sqlTest.android;

import java.util.ArrayList;
import java.util.List;

import android.app.Activity;
import android.app.ListActivity;
import android.os.Bundle;
import android.util.Log;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;

public class ShowData extends ListActivity {

	 private DataHelper dh;
	 private ArrayList<String> scannedTickets;
	 private ArrayList<String> tickets;
	 @Override
	 public void onCreate(Bundle savedInstanceState) {
		 super.onCreate(savedInstanceState);
	     //setContentView(R.layout.list_item);
		 dh = new DataHelper(this);
		 scannedTickets = new ArrayList<String>();
	 	 //tickets = (ArrayList<String>)getData();
	 	 ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, getDatabaseDump());
	 	 setListAdapter(adapter);     
	}
	public ArrayList<String> getDatabaseDump() {
		ArrayList<String> res = new ArrayList<String>();
		List<String> db = this.dh.selectAll();
		for (int i = 0; i < db.size()-1; i+=2) {
			res.add(db.get(i)+"     "+db.get(i+1));
		}
		return res;
	}
}
